#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const ll inf = 1e18;
using namespace std;

int N,W;
ll w[maxn],v[maxn];
ll dp[maxn];
int main(){
    // debug;
    ios;

    cin>>N>>W;
    for(int i = 1;i<=N;i++) cin>>w[i]>>v[i];
    for(int i = 1;i<=N;i++){
        for(int j = 100000;j>=v[i];j--){
            if(dp[j] == 0){
                if(dp[j-v[i]] != 0) dp[j] = dp[j-v[i]] + w[i];
                else if(j - v[i] == 0) dp[j] = w[i]; 
            }else{
                if(dp[j-v[i]] != 0) dp[j] = min(dp[j],dp[j-v[i]] + w[i]);
                else if (j - v[i] == 0) dp[j] = min(dp[j],w[i]); 
            }
        }
    }
    for(int i = 100000;i>=0;i--){
        if(dp[i] != 0 && dp[i] <= W){
            cout<<i<<'\n';
            return 0;
        }
    }
    cout<<0<<'\n';
    
    return 0;
}
